Minor change to the Module development guide#572
Conversation
✅ Deploy Preview for gethinode-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
markdumay
left a comment
There was a problem hiding this comment.
I appreciate your suggestion. The module guide is outdated, as the module template uses workspaces instead of replacements nowadays. I'd suggest the following content as a replacement. Please feel free to change your PR accordingly.
NB: GH has trouble rendering nested code blocks, you can copy everything below ---.
## Step 4 - Testing the KaTeX markup
The module template provides a simple website for local testing. Open the file `exampleSite/hugo.toml` and update the configuration:
```toml
# Build and serve using local mod-katex clone declared in the named Hugo workspace:
workspace = "mod-katex.work"
[[module.mounts]]
source = "static"
target = "static"
[[module.imports]]
path = "github.com/gethinode/mod-katex"
[[module.imports.mounts]]
source = "dist/katex.scss"
target = "static/katex.css"
[[module.imports.mounts]]
source = "dist/fonts"
target = "static/fonts"
[[module.imports.mounts]]
source = "dist/katex.js"
target = "static/js/katex.js"
[[module.imports.mounts]]
source = "dist/contrib/auto-render.js"
target = "static/js/auto-render.js"
[[module.imports.mounts]]
source = "assets/js/modules/katex/katex-autoload.js"
target = "static/js/katex-autoload.js"
[[module.imports.mounts]]
source = 'layouts'
target = 'layouts'The configuration uses a workspace to simplify local development. Rename the existing template file from mod-template.work to mod-katex.work for consistency. Ensure you reference the correct file in the above configuration.
Workspaces are of great help for local development and testing, as we would otherwise need to synchronize our repositories, submit a PR, and pull the latest version for each revision. The next line instructs our example site to use the mod-katex module (now sourced locally) and to adjust the mount points of the .css file and .js files. In this simple site for testing, we have no need for complex processing or bundling of assets, so we can use static imports instead.

Added the following instructions:
Make sure to keep the existing
workspace = "mod-katex.work"line from the template. Pay attention to also rename themod-template.workfile tomod-katex.workin the exampleSite directory.I am not sure wether I had missed a step but I needed to manually rename the
mod-template.workfile tomod-katex.workin the exampleSite directory, so I also mentioned it in the docs.